package ycl.important.controller.region;


import com.github.xiaoymin.knife4j.annotations.ApiSort;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import ycl.important.common.ApiResult;
import ycl.important.common.base.controller.BaseController;
import ycl.important.entity.region.Country;
import ycl.important.service.region.CountryService;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 国家表 前端控制器
 * </p>
 *
 * @author YCL
 * @since 2021-06-05
 */
@RestController
@RequestMapping("/region/country")
@Api(tags = "地区 - 国家")
@ApiSort(1)
public class CountryController extends BaseController {

	@Resource
	private CountryService countryService;

	@Override
	public ApiResult<Country> getById(Long id) {
		return ApiResult.success(countryService.getById(id));
	}


	@PostMapping("/getAll")
	public ApiResult<List<Country>> getAll(){
		List<Country> list = countryService.getAll();
		return ApiResult.success(list);
	}


}

